package com.car.controller.v1;

import com.itheima.apis.component.ComClassifyControllerApi;
import com.car.model.common.dtos.ResponseResult;
import com.car.model.component.dtos.ComClassifyDto;
import com.car.model.component.pojos.ComClassify;
import com.car.service.ComClassifyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/classify")
public class ComClassifyController implements ComClassifyControllerApi {


    @Autowired
    ComClassifyService comClassifyService;

    @PostMapping("/save")
    @Override
    public ResponseResult save(@RequestBody ComClassify classify) {
        return comClassifyService.saveClassify(classify);
    }

    @DeleteMapping("/{id}")
    @Override
    public ResponseResult delete(@PathVariable("id") Integer id) {
        return comClassifyService.delete(id);
    }

    @PostMapping("/update")
    @Override
    public ResponseResult update(@RequestBody ComClassify classify) {
        return comClassifyService.updateClassify(classify);
    }

    @PostMapping("/findByPage")
    @Override
    public ResponseResult findByPage(@RequestBody ComClassifyDto dto) {
        return comClassifyService.findByPage(dto);
    }
}
